package com.example.tys.baseapplication.View.recycleView.sticky;

import android.content.Context;

import com.example.tys.baseapplication.View.recycleView.BaseAdapter;
import com.example.tys.baseapplication.View.recycleView.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author tys
 * @date 2017/10/14
 */

public abstract class StickyAdapter<T, VH extends BaseViewHolder> extends BaseAdapter<T, VH> {

    protected StickyAdapter(Context context, ArrayList<T> mData) {
        super(context, mData);
    }


    public boolean needTitle(int position) {
        return position >= 0 && (position == 0 ||
                !getItemViewTitle(position).equals(getItemViewTitle(position - 1)));
    }

    public abstract String getItemViewTitle(int position);

}
